package com.dong.auth.security;

import com.dong.auth.security.matcher.RequestMatcher;

import javax.servlet.Filter;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
 *
 * 默认的安全过滤器链实现
 *
 * @author zhaodongchao
 * @date 2021/10/12 22:14
 * @version V1.0
 */
public class DefaultDongSecurityFilterChain implements DongSecurityFilterChain{

    private final RequestMatcher requestMatcher;

    private final List<Filter> filters;

    public DefaultDongSecurityFilterChain(RequestMatcher requestMatcher, List<Filter> filters) {
        this.requestMatcher = requestMatcher;
        this.filters = filters;
    }

    @Override
    public boolean matches(HttpServletRequest request) {
        return requestMatcher.matches(request);
    }

    @Override
    public List<Filter> getFilters() {
        return this.filters;
    }
}
